package git.determinal.template.view;





import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import io.swagger.annotations.ApiModel;

@ApiModel("单个排序参数")
@JsonInclude(Include.ALWAYS)
public class OrderField {
    private String field;
    private String sort = "ASC";

    public static OrderField of(String name) {
        OrderField fieldObj = new OrderField();
        fieldObj.setField(name);
        return fieldObj;
    }

    public static OrderField of(String name, OrderType orderType) {
        OrderField fieldObj = new OrderField();
        fieldObj.setField(name);
        fieldObj.setSort(orderType.getValue());
        return fieldObj;
    }

    public String getField() {
        return this.field;
    }

    public String getSort() {
        return this.sort;
    }

    public void setField(final String field) {
        this.field = field;
    }

    public void setSort(final String sort) {
        this.sort = sort;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof OrderField)) {
            return false;
        } else {
            OrderField other = (OrderField)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                Object this$field = this.getField();
                Object other$field = other.getField();
                if (this$field == null) {
                    if (other$field != null) {
                        return false;
                    }
                } else if (!this$field.equals(other$field)) {
                    return false;
                }

                Object this$sort = this.getSort();
                Object other$sort = other.getSort();
                if (this$sort == null) {
                    if (other$sort != null) {
                        return false;
                    }
                } else if (!this$sort.equals(other$sort)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof OrderField;
    }

    public int hashCode() {
        boolean PRIME = true;
        int result = 1;
        Object $field = this.getField();
        result = result * 59 + ($field == null ? 43 : $field.hashCode());
        Object $sort = this.getSort();
        result = result * 59 + ($sort == null ? 43 : $sort.hashCode());
        return result;
    }

    public String toString() {
        return "OrderField(field=" + this.getField() + ", sort=" + this.getSort() + ")";
    }

    public OrderField(final String field, final String sort) {
        this.field = field;
        this.sort = sort;
    }

    public OrderField() {
    }
}




